package com.horay.springclouddemo.stream.multiple.provider.listener;

import com.horay.springclouddemo.stream.multiple.provider.message.MessageSink;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Component;

/**
 * 消息监听器
 *
 * @author heyingcheng
 * @date 2020/3/29 16:40
 */
@Slf4j
@Component
public class MessageListener {

    @Value("${server.port}")
    private String serverPort;

    @StreamListener(MessageSink.LOG_FORMAT_INPUT)
    public void processFormatLogMessage(String message) {
        log.info("接收到格式化后的消息:[{}], PORT:[{}]", message, serverPort);
    }

}
